<?php
//рус
define("_ROOT_PATH", realpath(dirname(__FILE__)) . '/');

//define host name

//manual define host without www
#define('_HOST_NAME', 'example.host');

if (!defined('_HOST_NAME'))
{
	$hostName = $_SERVER['HTTP_HOST'] ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; 
	if (0 === strpos($hostName, 'www.'))
	{
		$hostName = substr($hostName, 4);
	}
	
	define('_HOST_NAME', $hostName);
}	
	
$pathToSite = str_replace('\\', '/', _ROOT_PATH);
if (strpos($pathToSite, $_SERVER['DOCUMENT_ROOT']) === 0)
{
	define("_ROOT_URL", substr($pathToSite, strlen($_SERVER['DOCUMENT_ROOT'])));
}
else
{
	define("_ROOT_URL", '/');	
}

define("_CORE_PATH", _ROOT_PATH . 'core/');
define("_APP_PATH", _ROOT_PATH . 'app/');
define('_CACHE_PATH', _ROOT_PATH . '_cache/');
define('_CACHE_CONFIG_PATH', _CACHE_PATH . '_config/');
define('_CACHE_FOLDER', '_cache/');
define("_FILES_DIR", 'files/');
define("_FILES_PATH", _ROOT_PATH . 'files/');

define("_EDITOR_DIR", "programs/ckeditor7/");
define("_EDITOR_PATH", _ROOT_PATH._EDITOR_DIR);
define("_EDITOR_URL", _ROOT_URL._EDITOR_DIR);

define("_CHMOD_DIR", 0777);
define("_CHMOD_FILE", 0777);

define("_FILEMANAGER_DIR", 'programs/filemanager4/');
define("_FILEMANAGER_PATH", _ROOT_PATH._FILEMANAGER_DIR);
define("_FILEMANAGER_URL", _ROOT_URL._FILEMANAGER_DIR);